package com.test.boot.http.rpc.server.service;

import com.test.boot.http.rpc.api.entity.User;
import com.test.boot.http.rpc.api.service.HelloService;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by hujianjun on 2015/12/4.
 */
public class HelloServiceImp implements HelloService {
    List<User> lists = new ArrayList<User>();

    @Override
    public String test(String input) {
        return input + new Date();
    }

    @Override
    public List<User> listUsers() {
        return lists;
    }

    @Override
    public User createUser(String name, int age) {
        User user = new User();
        user.id = lists.size();
        user.name = name;
        user.age = age;
        user.timeCreated = new Date();
        lists.add(user);
        return user;
    }
}
